using System;
using Microsoft.EntityFrameworkCore;

namespace CRM.Models.Email;

/// <summary>
/// rushmail接口关联表
/// </summary>
[Index(nameof(EmailMarketingId))]
[Index(nameof(State), nameof(TaskId), nameof(LatestTrackTime))]
public class RushMailLink
{
    public int Id { get; set; }
    
    public int EmailMarketingId { get; set; }
    public EmailMarketing EmailMarketing { get; set; }
    
    [Comment("地址池id")]
    public int PoolId { get; set; }
    [Comment("模板id")]
    public int TemplateId { get; set; }
    [Comment("任务id")]
    public int TaskId { get; set; }
    [Comment("跟踪id")]
    public int TrackId { get; set; }
    [Comment("最新跟踪时间")]
    public DateTime LatestTrackTime { get; set; }
    
    /// <summary>
    /// 任务状态
    /// </summary>
    public RushMailState State { get; set; }
}

public enum RushMailState
{
    /// <summary>
    /// 未初始化，一般不会存在
    /// </summary>
    Uninitialized,
    /// <summary>
    /// 已发送
    /// </summary>
    Send,
    /// <summary>
    /// 需要跟踪数据
    /// </summary>
    NeedTrack,
    /// <summary>
    /// 已完成
    /// </summary>
    Completed
}